// CyTargetLinker,
// a Cytoscape plugin to extend biological networks with regulatory interaction
// Copyright 2011-2012 BiGCaT Bioinformatics
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package cytargetlinker;

import giny.model.Node;

import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cytargetlinker.io.Edge;

/**
 * data object of a regulatory interaction network
 * contains regulatory interactions
 */
public class RegulatoryInteractionNetwork implements Comparable<RegulatoryInteractionNetwork> {
	
	private File file;
	private String name;
	private Color color;
	
	private Integer newInteractions;
	private List<Edge> edges;
	private String edgeType;
	private List<Node> cyNodes;
	private List<giny.model.Edge> cyEdges;
	
	// networks can be shown or hidden
	private boolean hidden = false;
	private List<Node> hiddenNodes;
	private List<giny.model.Edge> hiddenEdges;

	// used to store the coordinates of nodes to be able to restore them
	private Map<String, Double> xPosition; 
    private Map<String, Double> yPosition; 
	
    
	public RegulatoryInteractionNetwork() {
		edges = new ArrayList<Edge>();
		cyNodes = new ArrayList<Node>();
		hiddenNodes = new ArrayList<Node>();
		cyEdges = new ArrayList<giny.model.Edge>();
		xPosition = new HashMap<String, Double>(); 
		yPosition = new HashMap<String, Double>(); 
		hiddenEdges = new ArrayList<giny.model.Edge>();
	}
	
	/**
	 * orders the RINs based on the number of new interactions
	 */
	@Override
	public int compareTo(RegulatoryInteractionNetwork o) {
		return o.getNewInteractions().compareTo(getNewInteractions());
	}
	
	
	/** SETTERS AND GETTERS **/
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public Integer getNewInteractions() {
		return newInteractions;
	}

	public void setNewInteractions(Integer newInteractions) {
		this.newInteractions = newInteractions;
	}

	public File getFile() {
		return file;
	}

	public void setFile(File file) {
		this.file = file;
	}

	public List<Edge> getEdges() {
		return edges;
	}

	public void setEdges(List<Edge> edges) {
		this.edges = edges;
	}

	public String getEdgeType() {
		return edgeType;
	}

	public void setEdgeType(String edgeType) {
		this.edgeType = edgeType;
	}

	public List<Node> getCyNodes() {
		return cyNodes;
	}

	public void setCyNodes(List<Node> cyNodes) {
		this.cyNodes = cyNodes;
	}

	public List<Node> getHiddenNodes() {
		return hiddenNodes;
	}

	public void setHiddenNodes(List<Node> hiddenNodes) {
		this.hiddenNodes = hiddenNodes;
	}

	public List<giny.model.Edge> getCyEdges() {
		return cyEdges;
	}

	public void setCyEdges(List<giny.model.Edge> cyEdges) {
		this.cyEdges = cyEdges;
	}

	public Map<String, Double> getxPosition() {
		return xPosition;
	}

	public void setxPosition(Map<String, Double> xPosition) {
		this.xPosition = xPosition;
	}

	public Map<String, Double> getyPosition() {
		return yPosition;
	}

	public void setyPosition(Map<String, Double> yPosition) {
		this.yPosition = yPosition;
	}

	public boolean isHidden() {
		return hidden;
	}

	public void setHidden(boolean hidden) {
		this.hidden = hidden;
	}

	public List<giny.model.Edge> getHiddenEdges() {
		return hiddenEdges;
	}

	public void setHiddenEdges(List<giny.model.Edge> hiddenEdges) {
		this.hiddenEdges = hiddenEdges;
	}
	
}
